package com.example.extenddemo.controller;

import com.example.extenddemo.entity.WebSocketMessage;
import com.example.extenddemo.utils.WebSocketServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName WebSocketController
 * @Description TODO
 * @Author 郭敖
 * @Date 2024年03月25日 19:50
 * @Version 1.0
 */
@RestController
@RequestMapping("/ws")
public class WebSocketController {

    @PostMapping("/sendToUser")
    public String sendToUser(WebSocketMessage message){
        WebSocketServer.sendToSpecClient(message.getClientId(),message);
        return "success";
    }
}
